<?php

namespace app\index\controller\trade;

use app\index\model\UM as UM;
use app\index\service\TradeLandingService;
use ShidianUtil\Thinkphp\Response\ApiResponse;
use think\APP;
use think\Request as Request;

/**
 * Class Landing
 * @package app\index\controller\trade
 */
class Landing
{
    // 请求参数
    private Request $request;
    private TradeLandingService $tradeLandingService;


    public function __construct(Request $request, TradeLandingService $tradeLandingService)
    {
        $this->request = $request;
        $this->tradeLandingService = $tradeLandingService;
    }

    /**
     * 新增|修改
     * @param UM $user
     * @return ApiResponse
     * @url /trade/landing/save
     */
    public function save(UM $user): ApiResponse
    {
        $request = $this->request;

        $data = $this->tradeLandingService->add($user, $request->param());

        return ApiResponse::success($data);
    }

}
